<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Hello World</title>
  <script src="https://unpkg.com/vue"></script>

</head>

<body>
  <div id="root"></div>
  <script>
    /* 
      1. 具名插槽
        - <template #slotName>
        - <slot name="slotName"></slot>
    */

    const app = Vue.createApp({
      template: `
        <layout>
          <template #header><div>header</div></template>
          <template #footer><div>footer</div></template>
        </layout>
      `
    })
    app.component('layout', {
      data(){
        return {
          count: '999'
        }
      },
      template: `<div>
                  <slot name="header"></slot>
                  <div>content</div>
                  <slot name="footer"></slot>
                </div>`
    })
    const vm = app.mount('#root');
  </script>
</body>

</html>